package com.tom;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.mysql.jdbc.Driver;

public class List {

	public static void main(String[] args) {
		Connection conn = null;
		PreparedStatement pstmt = null;
		
		try {
			DriverManager.registerDriver(new Driver());
			conn = DriverManager.getConnection("jdbc:mysql://j.snpy.org/j102", "jstu", "abc123");
			String sq1 = "select * from guestbook";
			pstmt = conn.prepareStatement(sq1);
			ResultSet rs = pstmt.executeQuery();
			while (rs.next()){
				String userid = rs.getString("userid");
				String nickname = rs.getString("nickname");
				String title = rs.getString("title");
				
				System.out.println(userid + "/" + nickname + "/" + title);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}

}
